﻿@using RBS.Core.Model.Hotel
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@{
    ViewBag.Title = "ApiIndex";
    Layout = "";
    var hotelid = ViewBag.hotelId;
    RBS.Core.Model.Hotel.H_Hotels hotel = new RBS.Core.BLL.Hotel.H_Hotels().GetModelByCache(hotelid);
    var imgcount = 0;
    List<H_Hotel_Img> imgs = new RBS.Core.BLL.Hotel.H_Hotel_Img().GetModelList(1, 1, " and HotelId=" + hotelid, "id desc", out imgcount); //(" HotelId=" + hotelid);
    List<RBS.Core.Model.Hotel.H_Hotel_Cookbook> Cookbooks = new RBS.Core.BLL.Hotel.H_Hotel_Cookbook().GetModelList(" CategoryId in( select  id from H_Hotel_CookbookCategory where HotelId=" + hotelid + " and isdisplay=0  and EstimateClear<>'0'  ) ");
    List<RBS.Core.Model.UComment> comments = new RBS.Core.BLL.U_Comment().GetModelList("HotelId=" + hotelid); 
    
    var rj=new RBS.Core.BLL.Hotel.H_Hotels().GetRenJun(hotelid);
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>呷饭网</title>
        <link href="@Url.Content("~/Content/skin1/homepage.css")" rel="stylesheet" />
        <link href="@Url.Content("~/Content/ApiCSS/hotelDetail.css")" rel="stylesheet" />
        <script src="~/Scripts/jquery-1.8.2.js"></script>
        <script src="~/Scripts/jquery.anchor.1.0.js"></script>
        <style> 
            #iCenter{height:200px}
            .apkbtn {
	            border: 0 none;
	            width:150px;
	            height:45px;
	            background:transparent url(@Url.Content("~/images/btn-bg-1.gif")) no-repeat center center;
	            font-size:18px;
	            color:#FFF;
	            font-family:'Microsoft Yahei';
            }
        </style>
        <script language="javascript" src="http://webapi.amap.com/maps?v=1.3&key=6f8865b2771b70d90e610a0d6861227b"></script>
        <script language="javascript">
            var mapObj, toolBar;
            //初始化地图对象，加载地图
            function mapInit() {
                mapObj = new AMap.Map("iCenter", {
                    //二维地图显示视口
                    view: new AMap.View2D({
                        center: new AMap.LngLat(@hotel.Location),//地图中心点
                        zoom: 18 //地图显示的缩放级别
                    })
                });
                addMarker();
            }
            //添加marker标记
            function addMarker() {
                mapObj.clearMap();
                var marker = new AMap.Marker({
                    map: mapObj,
                    position: new AMap.LngLat(@hotel.Location), //位置 
                    icon: "http://webapi.amap.com/images/0.png" //复杂图标       
                });
                /* AMap.event.addListener(marker, 'click', function () { //鼠标点击marker弹出自定义的信息窗体
                     infoWindow.open(mapObj, marker.getPosition());
                 });*/
            }

            //实例化信息窗体
            var infoWindow = new AMap.InfoWindow({
                isCustom: true,  //使用自定义窗体
                content: createInfoWindow('方恒假日酒店&nbsp;&nbsp;<span style="font-size:11px;color:#F00;">价格:318</span>', "<img src='http://tpc.googlesyndication.com/simgad/5843493769827749134' style='position:relative;float:left;margin:0 5px 5px 0;'>地址：北京市朝阳区阜通东大街6号院3号楼 东北 8.3 公里<br/>电话：010 64733333<br/><a href='http://baike.baidu.com/view/6748574.htm'>详细信息</a>"),
                offset: new AMap.Pixel(16, -45)//-113, -140
            });

            //构建自定义信息窗体	
            function createInfoWindow(title, content) {
                var info = document.createElement("div");
                info.className = "info";

                //可以通过下面的方式修改自定义窗体的宽高
                //info.style.width = "400px";

                // 定义顶部标题
                var top = document.createElement("div");
                top.className = "info-top";
                var titleD = document.createElement("div");
                titleD.innerHTML = title;
                var closeX = document.createElement("img");
                closeX.src = "http://webapi.amap.com/images/close2.gif";
                closeX.onclick = closeInfoWindow;

                top.appendChild(titleD);
                top.appendChild(closeX);
                info.appendChild(top);


                // 定义中部内容
                var middle = document.createElement("div");
                middle.className = "info-middle";
                middle.style.backgroundColor = 'white';
                middle.innerHTML = content;
                info.appendChild(middle);

                // 定义底部内容
                var bottom = document.createElement("div");
                bottom.className = "info-bottom";
                bottom.style.position = 'relative';
                bottom.style.top = '0px';
                bottom.style.margin = '0 auto';
                var sharp = document.createElement("img");
                sharp.src = "http://webapi.amap.com/images/sharp.png";
                bottom.appendChild(sharp);
                info.appendChild(bottom);
                return info;
            }

            //关闭信息窗体
            function closeInfoWindow() {
                mapObj.clearInfoWindow();
            }

            function aaahref() {
                window.location.hash = "#comment";
                //location.href = "http://www.baidu.com"; 
            }
        </script>
    </head>
    <body onload="mapInit()">
        <div class="hotel01">
            <div id="iCenter"></div>
            <h1>@hotel.H_Name</h1>
            <p class="hoteltext">@hotel.Feature</p>
        </div>
        <div style="padding-bottom: 15px">
            <input type="button" name="btn1" value="预定" class="apkbtn" onclick="javascript: window.hotel.reserveHotel()" />
            <input type="button" name="btn1" value="收藏" class="apkbtn" onclick="javascript: window.hotel2.collectHotel()" />
        </div>
        <div class="wrapall">
            <div class="hotel02">
                <dl class="hotelinfo"> 
                    <dd class="tel">
                        <img   src="@Url.Content("~/Content/ApiCSS/images/icon-24x24-04.png")"/>电话：<u> @hotel.Telphone</u></dd>
                    @*<dd class="distance"><img src="images/icon-24x24-05.png" />距离：<u>1.32km</u></dd>*@
                    <dd class="address">@hotel.Address</dd>
                </dl>
                <dl class="hotelscore">
                    <dd class="score">
                        <i>@{
                            try
                            {
                            @Html.Raw(comments.Sum(c => Convert.ToInt32(c.jchj)) / comments.Count())
                            }
                            catch
                            {
                            @Html.Raw("0")
                            }
                        }分</i>
                    </dd>
                    <dd class="assess"><strong>@comments.Count()</strong>人评价＞<a id="btnBottom"  href="#comment">查看</a></dd>
                </dl>
                <dl class="hotelinfo2">
                    <dd><dfn>店铺菜系:</dfn>@hotel.Cuisine</dd>
                    <dd><dfn>人均消费:</dfn>@{
                        try
                        {
                        @Html.Raw(rj)
                        }
                        catch
                        {   @Html.Raw("0")
                        }
                    }元/人</dd>
                    <dd><dfn>营业时间:</dfn>@hotel.ShopBegintime-@hotel.ShopEndtime</dd>
                    <dd><dfn>设施服务:</dfn>WiFi：@(hotel.WIFI == "1" ? "有" : "无")
                    </dd>
                    <dd>
                        <dfn>停车位:</dfn>@hotel.Parking
                    </dd>
                    <dd>
                        <dfn>餐具是否免费:</dfn>@(hotel.Cutlery == "1" ? "免费" : "收费")
                    </dd>
                </dl>
            </div>
            <div class="hotelimg">
                <h2>酒店场景</h2>
                <ol>
                    @if (null != imgs)
                    {
                        var imgss = imgs.Skip(1).Take(10);
                        foreach (var img in imgss)
                        {
                        <li>
                            <img src="@RBS.Common.ConfigHelper.GetConfigString("hotelWeb")@img.ImgSrc" /></li>
                        }
                    }
                </ol>
            </div>
            <div class="hotelimg">
                <h2>招牌菜推荐</h2>
                <ol>
                    @if (null != @Cookbooks)
                    {
                        foreach (var cbook in Cookbooks)
                        {
                        <li>
                            <div class="mainimg">
                                <img src="@RBS.Common.ConfigHelper.GetConfigString("hotelWeb")@cbook.DishImages" alt="@cbook.Name" />
                            </div>
                            <h3>@cbook.Name</h3>
                            <dl class="score">
                                <dd class="money">￥<strong> @cbook.Discount</strong></dd>
                            </dl>
                        </li>
                        }
                    }
                </ol>
            </div>
            <a id="comment" name="comment"></a>
            <div class="hotelappraisal">
                @if (null != @comments)
                {
                    <h2>评价（@comments.Count() 人评价）</h2>
                    <p class="score">
                        @{
                    try
                    {
                            @Html.Raw(comments.Sum(c => Convert.ToInt32(c.jchj)) / comments.Count())
                    }
                    catch
                    {
                            @Html.Raw("0")
                    }
                        }分
                    </p>
                    <ol>

                        @foreach (var i in comments)
                        {
                            <li>
                                <h3>@i.jchj 分</h3>
                                <p class="name">@i.U_Uid</p>
                                <p class="date">@i.CommentTime</p>
                                <p class="text">@i.Comments</p>
                            </li>
                        }
                    </ol>
                }
            </div>
        </div>
    </body>
    </html>
}